using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NCS.Module.CMS.Library;
using NCS.Library.Utilities;
using NCS.Module.CMS.Library.Definitions;
using NCS.Module.CMS.Library.Zones;
using NCS.Library;
using NCS.Library.Components.Portal;

namespace NCS.Module.CMS.Web.SubPortal
{
    public partial class ContentFilters : CMSWebControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (curZone.Zone_Type == 6)
            {
                Boolean check = false;
                if (CurrentUser != null)
                {
                    DataTable dt = PortalController.GetPortals(CurrentUser.UserID, AppEnv.GetLanguage());
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dt.Rows[i]["PortalID"].ToString() == AppEnv.PortalId())
                            {
                                check = true;
                            }
                        }
                    }
                    if (check == false)
                    {
                        MessageBox.Show(MiscUtility.MSG_CONTROKEY_CANCEL);

                        return;
                    }
                }
                else
                {
                    Session["UrlKey"] = HttpContext.Current.Request.RawUrl;
                    Response.Redirect("/portalid/52/tabid/155.html");
                }
            }
            DataTable tbl = ZoneController.GetZones(curZone.Zone_ID, ConvertUtility.ToInt32(Portal[Constants.CMS_SubPortal + AppEnv.GetLanguage()]).ToString());
            if (tbl != null && tbl.Rows.Count > 0)
            {
                HeadZone headzone;
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    headzone = (HeadZone)LoadControl("HeadZone.ascx");
                    headzone.LoadZone(Int32.Parse(tbl.Rows[i]["Zone_ID"].ToString()));
                    this.PlaceHolder1.Controls.Add(headzone);
                }
            }
        }
    }
}